home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hack-Mag 3
/
Hack-Mag - Issue 3 (1991-02-02)(D-Tect)(PD).adf
/
Sources
/
CoderCorner.bas
next >
Wrap
BASIC Source File
|
2014-06-19
|
2KB
|
42 lines
Iter = 3
amin = -3
amax = 1
bmin = -1
bmax = 1.5
x=1:y=1 'startcoordinates on the Screen(for GFX)
xend=xs+100:yend=ys+100
cr=amin:ci=bmax 'real/imaginary startvalues of c
zr=0:zi=0 ' " " values of z(0)
AStep=(amax-amin)/100:BStep=(bmax-bmin)/100
WHILE y<yend 'until it is 100 pixels high
FOR s=1 TO Iter 'Iter is the max allowed numbers of iterations
'when there are no attractors found before
'the loop will be leaved
sr=zr*zr-zi*zi+cr 'New real part=old real part^2-old imaginary
'part + realpart of actual c
si=2*zi*zr+ci 'new im. part = 2*[old im. part]*[old real part]
'+im. part of actual c
r=sr*sr+si*si 'if squareroot of r<2 then this point is not
'part of the Mandelbrot-picture
IF r>=4 THEN GOTO LoopExit
zr=sr 'Old real part = new real part
zi=si 'Old im. part = new im. part
NEXT s 'the loop again
LoopExit:
zr=0:zi=0 'clear them again (for next point)
IF r>=4 THEN PSET(x-1,y),s-1 'if point belongs to the "Apfelmännchen"
'it is set in a color depending on the
'number of iterations
x=x+1 'xScreencoordinate of next point
IF x>xend THEN 'if already 100 pixels made we must start the
'2nd
y=y+1 'next line
x=1 'x is on the left again
cr=amin 'real part is left again, too
ci=ci-BStep 'im. part is now one line deeper
ELSE 'if not 100 pixels in x made then
cr=cr+AStep 'real part one point right
END IF
WEND